package cn.com.jni.dexshell;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;

public class MainActivity extends Activity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(stringFromJNI( ""));
        SignCheck signCheck = new SignCheck(this,"4A:83:1D:17:EE:B1:09:F3:09:92:01:C5:E7:88:2D:2B:D8:3A:19:75");
        if (!signCheck.check()){
            new AlertDialog.Builder(this)
                    .setMessage("签名信息不正确")
                    .setPositiveButton("确定",null)
                    .show();
        }
        else {
            new AlertDialog.Builder(this)
                    .setMessage("签名信息正确")
                    .setPositiveButton("确定",null)
                    .show();
        }
    }



    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI(String id);


}
